package org.bbelovic.devel.exercises.collatz;

public class AxisConfiguration {

    private final int height;
    private final int width;
    private final int padding;
    private final int xScale;
    private final int yScale;
    private final int xScaleStep;
    private final int yScaleStep;

    private AxisConfiguration(final AxisConfigurationBuilder builder) {
        this.height = builder.height;
        this.width  = builder.width;
        this.padding = builder.padding;
        this.xScale = builder.xScale;
        this.yScale = builder.yScale;
        this.xScaleStep = builder.xScaleStep;
        this.yScaleStep = builder.yScaleStep;
    }

    public int getHeight() {
        return height;
    }

    public int getWidth() {
        return width;
    }

    public int getPadding() {
        return padding;
    }

    public int getXScale() {
        return xScale;
    }

    public int getYScale() {
        return yScale;
    }

    public int getXScaleStep() {
        return xScaleStep;
    }

    public int getYScaleStep() {
        return yScaleStep;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("height=" + height)
          .append("width=" + width)
          .append("padding="+ padding)
          .append("xScale=" + xScale)
          .append("yScale=" + yScale)
          .append("xScaleStep="+ xScaleStep)
          .append("yScaleStep="+ yScaleStep);
        return sb.toString();
    }

    public static class AxisConfigurationBuilder {
        private int height;
        private int width;
        private int padding;
        private int xScale;
        private int yScale;
        private int xScaleStep;
        private int yScaleStep;

        public AxisConfigurationBuilder width(final int width) {
            this.width = width;
            return this;
        }

        public AxisConfigurationBuilder height(final int height) {
            this.height = height;
            return this;
        }

        public AxisConfigurationBuilder padding(final int padding) {
            this.padding = padding;
            return this;
        }

        public AxisConfigurationBuilder xScale(final int xScale) {
            this.xScale = xScale;
            return this;
        }

        public AxisConfigurationBuilder yScale(final int yScale) {
            this.yScale = yScale;
            return this;
        }

        public AxisConfigurationBuilder xScaleStep(final int xScaleStep) {
            this.xScaleStep = xScaleStep;
            return this;
        }

        public AxisConfigurationBuilder yScaleStep(final int yScaleStep) {
            this.yScaleStep = yScaleStep;
            return this;
        }

        public AxisConfiguration build() {
            return new AxisConfiguration(this);
        }
    } // AxisConfigurationBuilder
}
